package com.xsq.newmall01.ServiceImpl.UserServiceImpl;

import com.xsq.newmall01.Dao.Good;
import com.xsq.newmall01.Dao.User;
import com.xsq.newmall01.Mapper.UserMapper;
import com.xsq.newmall01.Service.UserService.UGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("usergoodservice")
public class UGoodServiceImpl implements UGoodService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<Good> getAllGoods() {
        // 调用mapper查询所有商家商品
        return userMapper.selectallgoods();
    }

    @Override
    public List<Good> getOwnedGoods(User user) {
        // 调用mapper查询用户拥有的商品
        return userMapper.selectownedgoods(user);
    }

    @Override
    public List<Good> getAllGoodsWithMerchantInfo() {
        return userMapper.selectAllGoodsWithMerchantInfo();
    }
}
